import unittest

def add(a, b):
    return a + b

class Test06(unittest.TestCase):
    def test01(self):
        result = add(1, 2)
        # 断言：判断两个值是否相等
        # assert result == 3
        self.assertEqual(result, 3)
    def test02(self):
        result = add(3, 4)
        is_ok = result == 8
        # 断言是否为True
        # self.assertFalse()
        self.assertTrue(is_ok)
    def test03(self):
        # 断言结果是否为空 None
        result = 1
        # self.assertIsNone(result)
        self.assertIsNotNone(result)
    def test04(self):
        # 断言是否包含某个字符串，前边的字符串是否出现在后边字符串中
        # result = '登录失败！错误原因：用户名不存在'
        result = '登录成功！欢迎回来'
        self.assertIn('登录失败', result)
if __name__ == '__main__':
    unittest.main()